﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Fluent;
using SkynetQuery;

namespace RibbonControlLibrary
{
    /// <summary>
    /// RibbonMainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class RibbonMainWindow : RibbonWindow
    {
        MainWindowViewModel _viewModel;
        public RibbonMainWindow()
        {
            InitializeComponent();
            _viewModel = new MainWindowViewModel(this.ribbon);


            List<ToolTabItem> list = new List<ToolTabItem>();
            ToolTabItem item = new ToolTabItem();
            item.Title = "主页";
            item.GroupItems = new List<ToolGroupItem>(){
                new ToolGroupItem{ Title ="数据源",Items =new List<ToolItem>{
                    new ToolItem{ Title ="新建数据源", Icon = "/Images/Tool/Add_16x16.png",LargeIcon="/Images/Tool/Add_32x32.png", 
                        ToolTip = new Tip{ Title="新建数据源", Content="增加一个数据源"},
                        QA = new QuickAccess{ IsChecked=true}
                    },
                    new ToolItem{ Title="新建文档",Icon = "/Images/Tool/new-16x16.png",LargeIcon="/Images/Tool/new-32x32.png", 
                        ToolTip = new Tip{Title="新建文档", Content="新建文档"}}
                    }
                },
                new ToolGroupItem{Title ="帮助",Items = new List<ToolItem>{
                    new ToolItem{Title="配置",LargeIcon="/Images/Tool/CustomizeMergeField_32x32.png"},
                     new ToolItem{Title="更新",LargeIcon="/Images/Update.png"},
                      new ToolItem{Title="关于",LargeIcon="/Images/Tool/About.png"}
                }}
            };
            list.Add(item);
            item = new ToolTabItem();
            item.Title = "工具";
            item.Contextual = new ContextualGroups { Background = Brushes.Green, Title = "查询" };
            item.GroupItems = new List<ToolGroupItem>(){
                new ToolGroupItem{ Title ="连接",Items =new List<ToolItem>{
                    new ToolItem{ Title ="连接", LargeIcon="/Images/Tree/btnConnect.png"},
                    new ToolItem{ Title="运行",LargeIcon="/Images/run.png"}
                }},
                new ToolGroupItem{Title ="调整",Items = new List<ToolItem>{
                    new ToolItem{Title="撤销",LargeIcon="/Images/Tool/undo-32x32.png"},
                     new ToolItem{Title="重做",LargeIcon="/Images/Tool/redo-32x32.png"},
                      new ToolItem{Title="注释",Icon="/Images/IndentIncrease_16x16.png",Size="Middle"},
                       new ToolItem{Title="取消注释",Icon="/Images/IndentDecrease_16x16.png",Size="Middle"},
                        new ToolItem{Title="格式刷",LargeIcon="/Images/FormatPainter.gif"}
                }},
                new ToolGroupItem{Title ="操作",Items = new List<ToolItem>{
                    new ToolItem{Title="剪切",Icon="/Images/Tool/cut-16x16.png",Size="Middle"},
                     new ToolItem{Title="粘贴",Icon="/Images/Tool/paste-16x16.png",Size="Middle"},
                      new ToolItem{Title="清空",Icon="/Images/Tool/Delete_16x16.png",Size="Middle"},
                       new ToolItem{Title="全选",LargeIcon="/Images/Tool/SelectAll_32x32.png"}
                }}
            };
             list.Add(item);
            _viewModel.LoadRibbonItems(list);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
         
            //if (this.toolsGroup.Visibility == System.Windows.Visibility.Visible)
            //{
            //    this.toolsGroup.Visibility = System.Windows.Visibility.Hidden;
            //    this.ribbon.SelectedTabItem = this.ribbon.Tabs[0];
            //}
            //else
            //{
            //    this.toolsGroup.Visibility = System.Windows.Visibility.Visible;
            //    RibbonTabItem item = this.ribbon.Tabs.FirstOrDefault(o => o.Group == this.toolsGroup);
            //    this.ribbon.SelectedTabItem = item;
            //}

        }
    }
}
